<!--
 * @Description:
 * @Version: 1.668
 * @Autor: 地虎降天龙
 * @Date: 2025-04-01 18:24:17
 * @LastEditors: 地虎降天龙
 * @LastEditTime: 2025-04-02 11:40:40
-->
<template>
  <el-button
    v-if="showButton"
    class="bt-tvt"
    type="primary"
    size="small"
    @click="stop()"
  >主应用控制子应用的小球</el-button>
</template>
<script>
import { startQiankun } from '../../qiankuncom/init.js'
export default {
  name: 'Appmicro',
  components: {},
  props: {
    showButton: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {}
  },
  mounted() {
    startQiankun()
  },
  methods: {
    stop() {
      window?.qiankunActions?.setGlobalState({
        message: '主应用发送给子应用的消息',
        curType: 'floatMove'
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.bt-tvt {
  position: absolute;
  z-index: 99999;
  right: 10px;
  top: 10px;
}
</style>
